/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "obj_structuredfund_part")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ObjStructuredFundPart.findAll", query = "SELECT o FROM ObjStructuredFundPart o"),
    @NamedQuery(name = "ObjStructuredFundPart.findByObj", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.obj = :obj"),
    @NamedQuery(name = "ObjStructuredFundPart.findByBaseObj", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.baseObj = :baseObj"),
    @NamedQuery(name = "ObjStructuredFundPart.findByMarketCode", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.marketCode = :marketCode"),
    @NamedQuery(name = "ObjStructuredFundPart.findByType", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.type = :type"),
    @NamedQuery(name = "ObjStructuredFundPart.findByRate", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.rate = :rate"),
    @NamedQuery(name = "ObjStructuredFundPart.findByOwnUserID", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.ownUserID = :ownUserID"),
    @NamedQuery(name = "ObjStructuredFundPart.findByAlterUserID", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.alterUserID = :alterUserID"),
    @NamedQuery(name = "ObjStructuredFundPart.findByCreateTime", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.createTime = :createTime"),
    @NamedQuery(name = "ObjStructuredFundPart.findByTimeStamp", query = "SELECT o FROM ObjStructuredFundPart o WHERE o.timeStamp = :timeStamp")})
public class ObjStructuredFundPart implements Serializable {
	public static byte[] EnCode(ObjStructuredFundPart msg) throws IOException {
		Codec<ObjStructuredFundPart> Lcode = ProtobufProxy.create(ObjStructuredFundPart.class);
		return Lcode.encode(msg);
	}
	public static ObjStructuredFundPart DeCode(byte[] data) throws IOException {
	Codec<ObjStructuredFundPart> Lcode = ProtobufProxy.create(ObjStructuredFundPart.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "BaseObj")
    @Protobuf
	private String baseObj;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "Type")
    @Protobuf
	private String type;
    @Basic(optional = false)
    @Column(name = "Rate")
    @Protobuf
	private float rate;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public ObjStructuredFundPart() {
    }

    public ObjStructuredFundPart(String obj) {
        this.obj = obj;
    }

    public ObjStructuredFundPart(String obj, String baseObj, String marketCode, float rate) {
        this.obj = obj;
        this.baseObj = baseObj;
        this.marketCode = marketCode;
        this.rate = rate;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getBaseObj() {
        return baseObj;
    }

    public void setBaseObj(String baseObj) {
        this.baseObj = baseObj;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public float getRate() {
        return rate;
    }

    public void setRate(float rate) {
        this.rate = rate;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (obj != null ? obj.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ObjStructuredFundPart)) {
            return false;
        }
        ObjStructuredFundPart other = (ObjStructuredFundPart) object;
        if ((this.obj == null && other.obj != null) || (this.obj != null && !this.obj.equals(other.obj))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.ObjStructuredFundPart[ obj=" + obj + " ]";
    }
    
}
